package com.bawan.vims.service.impl;

import java.io.Serializable;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.bawan.vims.common.IDGenerator;
import com.bawan.vims.common.util.DateUtil;
import com.bawan.vims.dao.IBaseDao;
import com.bawan.vims.dao.IEmployeeDao;
import com.bawan.vims.model.EmployeeInfo;
import com.bawan.vims.service.BaseService;
import com.bawan.vims.service.IEmployeeService;

/**
 * <p> Description	: EmployeeInfoServiceImpl.java </p>
 * <p> Copyright	: Copyright (c) 2015 by FITT</p>
 * <p> Author 		: ZCC </p>
 * <p> Create		: 2015年1月29日 下午6:47:35 </p> 
 * <p> version 		: 1.0 </p>
 */
@Service("employeeService")
public class EmployeeServiceImpl extends BaseService<EmployeeInfo> implements IEmployeeService {
	
	@Resource(name = "employeeDao")
	private IEmployeeDao employeeDao;
	
	public EmployeeServiceImpl() {
		super();
	}
	
	public IBaseDao<EmployeeInfo> getEmployeeDao() {
		return this.employeeDao;
	}
	
	public boolean save(EmployeeInfo entity) {
		if (entity.getEmployeeId() == null) {
			entity.setEmployeeId(IDGenerator.getIDByCurrentTime(17));
		}
		if (entity.getAddDate() == null) {
			entity.setAddDate(DateUtil.getCurrentDateString("YYYYMMddHHmmss"));
		}
		return employeeDao.save(entity);
	}
	
	public List<EmployeeInfo> findAll() {
		return employeeDao.findAll();
	}

	public boolean update(EmployeeInfo entity) {
		return employeeDao.update(entity);
	}

	public boolean delete(EmployeeInfo entity) {
		return employeeDao.delete(entity);
	}

	public EmployeeInfo findById(Integer id) {
		return employeeDao.findById(id);
	}

	@Override
	public boolean deleteById(Serializable id) {
		return employeeDao.deleteById(id);
	}
}
